package prefuse.demos;




import java.awt.Color;
import java.awt.Dimension;
import java.io.IOException;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JSplitPane;


import prefuse.data.Table;
 
/**
 *
 * @web http://java-buddy.blogspot.com/
 */
public class StartUp {
	private TreeViewByInformation tview;
    /**
     * @param args the command line arguments
     * @throws IOException 
     */
    public static void main(String[] argv) throws IOException {
   //     SwingUtilities.invokeLater(runJSplitPaneLater);
        
        String infile = "/ann880testresult.xml";
		Color colorInFrame;
		//	String infile = "/WNVExampleTree2Week.xml";
			String label = "name";
			
			if (argv.length > 1) {
				infile = argv[0];
				label = argv[1]; // label is the fist element of the array
			}
			StartUp start = new StartUp();
			 JSplitPane jSplitPane, jSplitPane2;
		        JPanel jPanel1, jPanel2a, jPanel2b;
		    
		    	
		    	
		    	
		    	JFrame frame = new JFrame("DecisionTreeView");
			
				
	            jPanel1 = new JPanel();
	            jPanel2a = new JPanel();
	            jPanel2b = new JPanel();
	            JFrameWin colorPanel = new JFrameWin();
	            
	            JComponent treeview = start.tview.demo(infile, label, colorPanel);
	            
	            double[] timeList = new double[]{17.5,20,30};
	            TableCreater t = new TableCreater();
	            
	    		Table table = t.generateTable("C:\\tmp\\rabbitann.txt","deaths",timeList);
	    		final JComponent display = t.createVisualization(table);

				
				
	            String course[] = {"BCA","MCA","PPC","CIC"};
	            JComboBox combo = new JComboBox(course);
	            combo.setPreferredSize(new Dimension(200,20));
	        	Box box = new Box(BoxLayout.Y_AXIS);
	        	box.add(combo);
	        	box.add(display);
	            jPanel2a.add(box);
	       
	            
	            jSplitPane2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, 
	                    jPanel2a, colorPanel);
	            jSplitPane2.setOneTouchExpandable(true);
	            jSplitPane2.setDividerLocation(330);
	             
	            jSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, 
	            		treeview, jSplitPane2);
	            jSplitPane.setOneTouchExpandable(true);
	            jSplitPane.setDividerLocation(600);
	             
	            frame.getContentPane().add(jSplitPane);
	            
	        	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
				frame.pack();
				frame.setVisible(true);
    }

     
    
}